package com.credithc.customers.base.ro;

import com.credithc.customers.base.codes.CustomerCodes;
import com.credithc.customers.base.exception.CustomerException;
import com.credithc.customers.base.utils.CustomerUtils;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

/**
 * @description: 用户什么信息变更入参表
 * @author: fby
 * @date: 2020/1/20 10:42
 * @param: null
 * @return:
 */
@Data
public class CustomerUnifyUpdateRo extends CustomerBaseRo {

    private String preCustomerNo;

    private String customerNo;

    private String subSystemSign;

    private String idCardType;

    private String idCardNo;

    private String customerName;

    private String accessToken;

    public static void checkBaseParam(CustomerUnifyUpdateRo ro) {

        if (StringUtils.isBlank(ro.getAccessToken()) || StringUtils.isBlank(ro.getCustomerName()) || StringUtils.isBlank(ro.getIdCardNo()) || StringUtils.isBlank(ro.getIdCardType())) {
            throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "参数不能为空!");
        }
        CustomerUtils.checkIdCardTypeAndNo(ro.getIdCardType(), ro.getIdCardNo());
        CustomerUtils.checkIdCardType(ro.getIdCardType());
    }

}
